package view;

import java.awt.Point;

import model.*;

public class EssentialGeometry
{
	public final static int MIN_DIST = 5;
	public final static int MIN_DIST_SQ = MIN_DIST * MIN_DIST; // the min selectable distance squared
	
	public static Selection canSelect(DrawObject Obj, Point mouseLoc)
	{
		if (Obj instanceof DrawLine)
			return canSelectLine(Obj, mouseLoc);
		
		else if (Obj instanceof DrawRect)
			return canSelectRect(Obj, mouseLoc);
		
		else if (Obj instanceof DrawEllipse)
			return canSelectEllipse(Obj, mouseLoc);
		
		else if (Obj instanceof DrawBezier)
			return canSelectBezier(Obj, mouseLoc);
		
		else if (Obj instanceof DrawText)
			return canSelectText(Obj, mouseLoc);
		
		return new Selection();
	}

	private static Selection canSelectText(DrawObject obj, Point mouseLoc)
	{
		// TODO Auto-generated method stub
		return new Selection();
	}

	private static Selection canSelectBezier(DrawObject obj, Point mouseLoc)
	{
		// TODO Auto-generated method stub
		return new Selection();
	}

	private static Selection canSelectEllipse(DrawObject obj, Point mouseLoc)
	{
		// TODO Auto-generated method stub
		return new Selection();
	}

	private static Selection canSelectRect(DrawObject obj, Point mouseLoc)
	{
//		DrawRect dRect = (DrawRect)obj;
//		BoundBox bounds = dRect.getBounds();
//		
//		if (!bounds.contains(mouseLoc))
//			return new Selection();
//		
//		if ( dRect.distSqToShape(mouseLoc) <= MIN_DIST_SQ)
//			return new Selection(true, false);
		
		
		return new Selection();
	}

	private static Selection canSelectLine(DrawObject obj, Point mouseLoc)
	{					
//		if (obj.containsPoint(mouseLoc))
//			return new Selection(true, false);
		
		return new Selection();
	}
	
	
	
	
	
	
	
}
